package com.aldobucchi.x.flash.utils.Timer
{
	import flash.events.Event;
	import flash.events.TimerEvent;
	import flash.utils.Timer;
	import flash.utils.getTimer;
	
	public class TimerUtil
	{
		
		
		
		public static function callLater( func:Function, args:Array=null, delay:Number=100 ):void
		{
			var t:Timer = new Timer( delay, 1 );
			t.addEventListener(TimerEvent.TIMER_COMPLETE, function(e:Event):void{
					func.apply( null, args )
				} );
			t.start( );
		}
		
		
		
		private static var timer:int;
		public static function time( message:String = null ):void
		{
			if ( message == null )
				timer = getTimer( );				
			else
				trace( message + " " + ( getTimer( ) - timer ) + " ms" );				
		}		
		
		
	}
	
}